#pragma once
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#define MAX 10//缓冲区大小
#define NONE_FLUSH  001 //0001
#define LINE_FLUSH  002 //0010
#define FULL_FLUSH  004 //0100

typedef struct IO_FILE{
    int fileno;//文件描述符
    int flag;
    char outbuff[MAX]; //缓冲区
    int bufflen; //缓冲区内容长度
    int flush_buff;
}MYFILE;

MYFILE* MyOpen(const char* pathname, const char* mode);
void MyClose(MYFILE* file);
int MyWrite(MYFILE* file, void* str, int len);
void MyFlush(MYFILE* file);
